package com._430haus.FileLister;

import java.io.IOException;
import java.net.ServerSocket;
import com._430haus.PreferenceLoader.PreferenceLoader;

public class FileLister extends Thread {
	
	public FileLister(){
		
	}
	
	@Override
	public void run(){
		waitForConnections();
	}
	
	private void waitForConnections(){
		PreferenceLoader pl = PreferenceLoader.getInstance();
		try (ServerSocket serverSocket = new ServerSocket(pl.getFileListerPortPreference())) {

			while (true) {
				//synchronized(this) {
					new FileListerClientThread(serverSocket.accept()).start();
				//}
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
